home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Media Design Review 1999
/
Interactive Media Design Review 1999.iso
/
pc
/
Demos
/
Bombardier_PC
/
DATACH.CST
/
00143_Script_143
< prev
next >
Wrap
Text File
|
1999-03-07
|
10KB
|
318 lines
-- misc database routines
global dbHandle, qdhandle, rshandle
-- fill competitor list for popup
on getAircrafts
global currentChartName, currentplane
InitDB "aircraft.mdb"
set ccn = spacetounderscore(currentChartName)
if currentChartName = "Range_maps" then
set ccn = "all"
end if
set qdHandle =DGQDOpen("Competitors_per_config",dbHandle)
if qdHandle="#ERROR" then
alert "Error:"&&GetLastDGError()
end if
if DGQDsetParameterValue("Model", currentplane, qdhandle) = "#ERROR#" then
put "p:"&&GetLastDGError()
end if
if DGQDsetParameterValue("task", ccn, qdhandle) = "#ERROR#" then
put "p:"&&GetLastDGError()
end if
set rsHandle=DGQDCreateRS(qdHandle)
if rsHandle = "#ERROR#" then
-- alert "error reading competitors"
nothing
else
put "" into field "mdl_field"
Repeat while not DGRSIsEof(rsHandle)
set val=DGRSGetFieldValue("Competitor",rsHandle)
set cline = the linecount of member "mdl_field"
put val&"" into line cline+1 of field "mdl_field"
-- put val
DGRSMoveNext(rsHandle)
end repeat
set cline = the linecount of member "mdl_field"
put "NONE"&"" into line cline+1 of field "mdl_field"
if DGQDIsOpen(qdhandle) then
DGQDClose(qdhandle)
end if
if DGRSIsOpen(rsHandle) then
DGRSClose(rsHandle)
end if
-- dbhandle(mdispose)
end if
compcheck
-- InitDBch
end
-- hide competitor triangle and type for each section
on compcheck
global compdrawplace
if the linecount of member "mdl_field" < 2 then
if compdrawplace = "performance" then
killsprite 46
killsprite 29
killsprite 5
killsprite 3
killsprite 39
end if
if compdrawplace = "specs" then
killsprite 50
killsprite 51
killsprite 44
end if
if compdrawplace = "maps" then
killsprite 35
killsprite 41
end if
if compdrawplace = "hourly" then
killsprite 5
killsprite 20
killsprite 45
end if
if compdrawplace = "Annual" then
killsprite 5
killsprite 44
killsprite 45
end if
end if
end
on killsprite spritenum
puppetsprite spritenum, true
set the visible of sprite spritenum = false
end
-- get chart names for popup menu
on getchartnames
global currentChartName, currentplane
InitDB "aircraft.mdb"
set qdHandle =DGQDOpen("ChartNames",dbHandle)
if qdHandle="#ERROR" then
alert "Error:"&&GetLastDGError()
end if
if DGQDsetParameterValue("Model", currentplane, qdhandle) = "#ERROR#" then
put "p:"&&GetLastDGError()
end if
set rsHandle=DGQDCreateRS(qdHandle)
if rsHandle = "#ERROR#" then
alert "Chart DB Error"
else
put "" into field "chart_field"
Repeat while not DGRSIsEof(rsHandle)
set val=DGRSGetFieldValue("Chart",rsHandle)
set val=underscoretospace(val)
set cline = the linecount of member "chart_field"
put val&"" into line cline+1 of field "chart_field"
-- put val
DGRSMoveNext(rsHandle)
end repeat
if DGQDIsOpen(qdhandle) then
DGQDClose(qdhandle)
end if
if DGRSIsOpen(rsHandle) then
DGRSClose(rsHandle)
end if
-- dbhandle(mdispose)
-- InitDBch
end if
set currentChartName = line 1 of field "chart_field"
end
-- get cost of ownership hours for popup menu
on getOcHours
global currentChartName, currentplane
InitDB "aircraft.mdb"
set qdHandle =DGQDOpen("OC_HoursValues",dbHandle)
if qdHandle="#ERROR" then
alert "Error:"&&GetLastDGError()
end if
if DGQDsetParameterValue("Model", currentplane, qdhandle) = "#ERROR#" then
put "p:"&&GetLastDGError()
end if
set rsHandle=DGQDCreateRS(qdHandle)
put "" into field "Hours_field"
Repeat while not DGRSIsEof(rsHandle)
set val=DGRSGetFieldValue("Hours",rsHandle)
if (DGRSGetFieldValue("Conklin",rsHandle)=1) then set val = "Conklin"
set cline = the linecount of member "Hours_field"
put val&"" into line cline+1 of field "Hours_field"
-- put val
DGRSMoveNext(rsHandle)
end repeat
-- set cline = the linecount of member "Hours_field"
-- put "NONE"&"" into line cline+1 of field "Hours_field"
if DGQDIsOpen(qdhandle) then
DGQDClose(qdhandle)
end if
if DGRSIsOpen(rsHandle) then
DGRSClose(rsHandle)
end if
-- dbhandle(mdispose)
-- InitDBch
set the text of field "bar_hours" = "Conklin"
end
-- get regions for popup menu
on getOcRegions
global currentChartName, currentplane
InitDB "aircraft.mdb"
set qdHandle =DGQDOpen("OC_RegionValues",dbHandle)
if qdHandle="#ERROR" then
alert "Error:"&&GetLastDGError()
end if
if DGQDsetParameterValue("Model", currentplane, qdhandle) = "#ERROR#" then
put "p:"&&GetLastDGError()
end if
set rsHandle=DGQDCreateRS(qdHandle)
put "" into field "Region_field"
Repeat while not DGRSIsEof(rsHandle)
set val=DGRSGetFieldValue("Region",rsHandle)
set cline = the linecount of member "Region_field"
put val&"" into line cline+1 of field "Region_field"
-- put val
DGRSMoveNext(rsHandle)
end repeat
-- set cline = the linecount of member "Region_field"
-- put "NONE"&"" into line cline+1 of field "Region_field"
if DGQDIsOpen(qdhandle) then
DGQDClose(qdhandle)
end if
if DGRSIsOpen(rsHandle) then
DGRSClose(rsHandle)
end if
-- dbhandle(mdispose)
-- InitDBch
set the text of field "bar_Region" = line 1 of field "Region_field"
end
-- get defaults for bars
on getOCdefaults
global currentChartName, currentplane
InitDB "aircraft.mdb"
set qdHandle =DGQDOpen("Default_ValuesQ",dbHandle)
if qdHandle="#ERROR" then
alert "Error:"&&GetLastDGError()
end if
set rsHandle=DGQDCreateRS(qdHandle)
set def_fuel=DGRSGetFieldValue("Default Fuel Rate",rsHandle)
if def_fuel = "#ERROR#" then
put "Error:"&&GetLastDGError()
end if
set def_labor=DGRSGetFieldValue("Default Labor Rate",rsHandle)
if def_labor = "#ERROR#" then
put "Error:"&&GetLastDGError()
end if
set the floatPrecision = 2
set the text of field "DefaultFuel" = "$ " & string(value(def_fuel))
set the text of field "DefaultLabor" = "$ " & string(value(def_labor))
if DGQDIsOpen(qdhandle) then
DGQDClose(qdhandle)
end if
if DGRSIsOpen(rsHandle) then
DGRSClose(rsHandle)
end if
end
-- set up assumtion text for printing
on getAssumptions
global fixedChartName,currentchartname, currentplane, Out_Text
global DDDRECORD, qddhandle
InitDB "aircraft.mdb"
set fixedchartname = spacetounderscore(currentchartname)
set currentcompetitor = the text of field "displane"
set Out_Text = ""
set qdHandle =DGQDOpen("AssumptionText",dbHandle)
if qdHandle="#ERROR" then
alert "Error:"&&GetLastDGError()
end if
if DGQDsetParameterValue("Chart Name", fixedChartName, qdhandle) = "#ERROR#" then
put "p:"&&GetLastDGError()
end if
set DBRECORD=DGQDCreateRS(qdHandle)
Repeat while not DGRSIsEof(DBRECORD)
set Bshowboth = DGRSGetFieldValuech("Display_Both",DBRECORD)
set Bshowplane = DGRSGetFieldValuech("Show_Plane_Name",DBRECORD)
set Bnextline = DGRSGetFieldValuech("Next_Line",DBRECORD)
set pretext = DGRSGetFieldValuech("Pre_text",DBRECORD)
set Param_Name = DGRSGetFieldValuech("Field_Name",DBRECORD)
set posttext = DGRSGetFieldValuech("Post_text",DBRECORD)
if Bnextline then
set posttext = posttext & RETURN
else
set posttext = posttext & ", "
end if
if Bshowplane then set Out_Text = Out_Text & currentplane
set Out_Text = Out_Text & pretext
set lp = length(Param_Name)
if lp > 3 then
set clearqdflag = TRUE
set ix = offset(".", Param_Name)
set itable = char 1 to (ix-1) of Param_Name
set iparam = char (ix+1) to lp of Param_Name
set iqx = "Q_" & itable
set qddHandle =DGQDOpen(iqx,dbHandle)
if qddHandle="#ERROR" then
alert "Error:"&&GetLastDGError()
end if
if DGQDsetParameterValue("Model", currentplane, qddhandle) = "#ERROR#" then
put "p:"&&GetLastDGError()
end if
set DDDRECORD=DGQDCreateRS(qddHandle)
--
--
-- set isql = "SELECT * FROM " & itable
-- set DDDRECORD = DGcreateRecordset(isql, DBHANDLE)
-- set chquery = "Aircraft = " & QUOTE & currentplane & QUOTE
-- set outresult =DGRSfindFirst(chquery, DDDRECORD)
set paramValue = DGRSGetFieldValuech(iparam,DDDRECORD)
set Out_Text = Out_Text && formatch(paramValue)
end if
set Out_Text = Out_Text && posttext
if Bshowboth then
if (length(currentcompetitor) > 4) and (currentcompetitor<>"No Competitor") then
if Bshowplane then set Out_Text = Out_Text && currentcompetitor
set Out_Text = Out_Text && pretext
set lp = length(Param_Name)
if lp > 3 then
set ix = offset(".", Param_Name)
set itable = char 1 to (ix-1) of Param_Name
set iparam = char (ix+1) to lp of Param_Name
set isql = "SELECT * FROM " & itable
set DDDRECORD = DGcreateRecordset(isql, DBHANDLE)
set chquery = "Aircraft = " & QUOTE & currentcompetitor & QUOTE
set outresult =DGRSfindFirst(chquery, DDDRECORD)
set paramValue = DGRSGetFieldValuech(iparam,DDDRECORD)
set Out_Text = Out_Text && formatch(paramValue)
end if
set Out_Text = Out_Text && posttext
end if
end if
DGRSMoveNext(DBRECORD)
if clearqdflag then
if DGQDIsOpen(qddhandle) then
DGQDClose(qddhandle)
end if
if DGRSIsOpen(DDDRECORD) then
DGRSClose(DDDRECORD)
end if
set clearqdflag = FALSE
end if
end repeat
delete the last char of Out_Text
-- put Out_Text
if DGQDIsOpen(qdhandle) then
DGQDClose(qdhandle)
end if
if DGRSIsOpen(DBRECORD) then
DGRSClose(DBRECORD)
end if
end